package smallDemend;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * 评委打分
 * 指定评委数量打分
 * 除去最低分和最高分
 * 计算平均值
 */
public class Grade {
    public static void main(String[] args) {
        ArrayList<Double> list = new ArrayList<>();
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < 6; i++) {
            System.out.println("请输入第" + (i + 1) + "位评委的分数：");
            double power = sc.nextDouble();
            list.add(power);
        }
        Collections.sort(list);
        list.remove(0);
        list.remove(list.size() - 1);
        double sum = 0;
        for (Double dou : list) {
            sum += dou;
        }
        System.out.println("最终成绩为：" + sum / 4);
    }
}
